package org.scirp.ijmis.dao.personpaper.impl;

import java.util.HashMap;
import java.util.Map;

import org.scirp.ijmis.dao.base.impl.BaseDAOImpl;
import org.scirp.ijmis.dao.personpaper.IProofReadDAO;
import org.scirp.ijmis.po.personpaper.ProofRead;

public class ProofReadDAOImpl extends BaseDAOImpl<ProofRead> implements IProofReadDAO {
	private static final String className = ProofReadDAOImpl.class.toString();

	public boolean saveOrUpdateProofRead(ProofRead proofRead) {
		return super.updateObject(proofRead, className + "-->saveProofRead");
	}

	public ProofRead selectByPaperId(Long paperId) {
		String hql = "from ProofRead where paper.pid=:paperId order by pid desc";
		Map<String, Long> parameters = new HashMap<String, Long>();
		parameters.put("paperId", paperId);
		return (ProofRead) super.selectSingle(hql, parameters, className + "-->selectByPaperId");
	}

	public boolean deleteProofRead(Long proofReadId) {
		String hql = "delete from ProofRead where pid=:pid";
		Map<String, Long> parameters = new HashMap<String, Long>();
		parameters.put("pid", proofReadId);
		return super.ExecuteNonQuery(hql, parameters, className + "-->deleteProofRead(Long proofReadId)");
	}

}
